package com.ashlikun.frame.simple.wheel.adapter;

import android.view.LayoutInflater;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.ashlikun.frame.simple.R;

import java.util.List;


public class TestAdapter2 extends RecyclerView.Adapter<UserViewHolder> {
    private final List<UserBean> userBeanList;

    public TestAdapter2(List<UserBean> userBeanList) {
        this.userBeanList = userBeanList;
    }

    @Override
    public int getItemCount() {
        return userBeanList.size();
    }

    @Override
    public UserViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new UserViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.wheelview_item2, null, false));
    }


    @Override
    public void onBindViewHolder(UserViewHolder holder, int position) {
        UserBean userBean = userBeanList.get(position);
        holder.iv_head.setImageResource(userBean.drawable);
        holder.tv_name.setText(userBean.name);
    }
}
